'use strict';
const Controller = require('egg').Controller;
const { responseFormat, responseHandleFormat, tokenDisabled } = require('../public/js/utils');

class RoleController extends Controller {

  // 查询所有的页面路由地址
  async findAllRole() {
    const { ctx } = this;
    const { list } = await ctx.service.role.findAllRole();
    ctx.body = responseFormat(true, list);
  }

  async saveEditRole() {
    const { ctx } = this;
    const { id, name, pages } = ctx.request.body;
    const result = await ctx.service.role.saveEditRole(id, name, pages);
    ctx.body = responseHandleFormat(result);
  }
}
module.exports = RoleController;
